Time measurement circuit, system having a PWM signal generator circuit and a time measurement circuit, and corresponding integrated circuit

ABSTRACT

A time measurement includes a multiphase clock generator and a phase sampling circuit. The multiphase clock generator generates a sequence of a given number n of phase shifted clock phases, wherein one of the phase shifted clock phases represents a reference clock signal. The phase sampling circuit is configured to generate a phase value indicative of a number of fractions 1/n of the clock period of the clock phases elapsed between an edge of the reference clock signal and an instant when an asynchronous event signal is set. The phase sampling circuit includes first through fourth sub-circuits, which respectively generate or determine first through fourth control signals.

BACKGROUND Technical Field

The embodiments of the present description refer to time measurementcircuits.

Description of the Related Art

Time measurement circuits (chronometers) configured to measure the timeelapsed between a first (start) event and a second (stop) event may beuseful in a variety of application.

For example, a time measurement circuit may be useful in the context ofPWM signals. Generally, as shown in FIG. 1, a PWM signal is a periodicsignal having a given switching period T_(SW), wherein the PWM signal isset to high for a given switch-on duration T_(ON) and low for a givenswitch-off duration T_(OFF), with:T _(SW) =T _(ON) +T _(OFF).  (1)

Moreover, often is defined the duty cycle D of the PWM signal, withD=T_(ON)/T_(SW).

Such a PWM signal may be generated in various modes. For example, asshown in FIG. 1, one of the simplest solutions is based on an oscillatorcircuit generating a clock signal CLK and a counter configured toincrease a count value in response to the clock signal CLK. Thus, byusing a comparator circuit the PWM signal may be generated as a functionof the count value provided by the counter, e.g., by comparing the countvalue with given threshold values, e.g., indicative of the switch-onduration T_(ON) and the switching period T_(SW).

For example, a time measurement circuit may be useful when the PWMsignal is used to drive (e.g., via a half or full bridge) a resonantcircuit comprising one or more inductances and/or capacitances, e.g., aLC resonant tank. For example, a typical application may be a wirelesspower transmitter, or an electronic converter. For example, in thisapplication it may be useful to measure the time elapsed between therising and/or falling edge of the PWM signal (representing the startevent) and a given event (generated in response to the rising or fallingedge of the PWM signal). For example, the chronometer may measure thetime elapsed between the rising edge of the PWM signal and the instantwhen a current flowing through a given component of the resonant tank orthe voltage at a given component or node of the resonant tank reaches agiven threshold value, e.g., the current flowing through or the voltageat one of the components of the LC resonant tank, such as the voltage ata ringing node of the LC resonant tank.

BRIEF SUMMARY

Considering the foregoing, various embodiments of the present disclosureprovide solutions for measuring a time elapsed between a start event anda stop event. More specifically, various embodiments relate to solutionsfor determining a phase value indicative of a time elapsed between anedge of a clock signal and an instant when an asynchronous event signalis set.

According to one or more embodiments, a time measurement circuit isprovided having the distinctive elements set forth in the followingdescription. The embodiments also concern a corresponding systemcomprising a PWM signal generator circuit and a time measurementcircuit, and a corresponding integrated circuit.

Various embodiments of the present disclosure relate to a timemeasurement circuit configured to generate a phase value.

In various embodiments, the time measurement circuit comprises amultiphase clock generator configured to generate a sequence of a givennumber n of phase shifted clock phases having the same clock period andbeing phase shifted by a time corresponding to a fraction 1/n of theclock period, wherein one of the phase shifted clock phases represents areference clock signal.

In various embodiments, the time measurement circuit comprises also anode for receiving an asynchronous event signal, and a phase samplingcircuit configured to generate the phase value, the phase value beingindicative of the number of the fractions 1/n of the clock periodelapsed between an edge of the reference clock signal and the instantwhen the asynchronous event signal is set.

In various embodiments, the phase sampling circuit comprises varioussub-circuits.

Specifically, in various embodiments, a first sub-circuit comprises foreach of the phase shifted clock phases a respective first flip-flop,each of the first flip-flops being configured to, in response to theasynchronous event signal, sample the respective phase shifted clockphase, thereby determining a respective first control signal indicatingwhether the respective clock phase was set to high or low at the instantwhen the asynchronous event signal was set.

In various embodiments, a second sub-circuit comprises for each of thephase shifted clock phases a respective second flip-flop, each of thesecond flip-flops being configured to, in response to the respectivephase shifted clock phase, sample a respective first control signal,thereby determining a respective second control signal corresponding toa synchronized version of the respective first control signal.

For example, in various embodiments, each of the first flip-flops isconfigured to sample the respective phase shifted clock phase inresponse to a rising edged of the asynchronous event signal, and each ofthe second flip-flops is configured to sample the respective firstcontrol signal in response to a falling edge of the respective phaseshifted clock phase.

In various embodiments, the time measurement circuit may comprise foreach of the phase shifted clock phases a respective logic OR gate, eachlogic OR gate receiving at input a respective first control signalprovided by a respective first flip-flop and a respective second controlsignal provided by a respective second flip-flop, thereby determining arespective control signal, and wherein each of the second flip-flops isconfigured to sample one of these control signals, whereby each of thesecond flip-flops samples a respective first control signal only whenthe respective first control signal is set to high.

In various embodiments, a third sub-circuit is configured to associatewith each of the phase shifted clock phases a further clock phase, thefurther clock phase corresponding to the phase shifted clock phase ofthe sequence of phase shifted clock phases preceding the respectiveclock phase with the time corresponding to the fraction 1/n of the clockperiod. Moreover, the third sub-circuit determines for each of the phaseshifted clock phases a respective third control signal indicatingwhether:

-   -   the second control signal associated with the respective phase        shifted clock phase indicates that the respective phase shifted        clock phase was set to low at the instant when the asynchronous        event signal was set, and    -   the second control signal associated with the respective further        clock phase indicates that the respective further clock phase        was set to high at the instant when the asynchronous event        signal was set.

For example, in various embodiments, the third sub-circuit comprises foreach of the phase shifted clock phases a respective logic AND gate, eachlogic AND gate receiving at input the inverted version of the secondcontrol signal associated with the respective phase shifted clock phase,and the second control signal associated with the respective furtherclock phase, thereby generating the respective third control signal.

In various embodiments, a fourth sub-circuit comprises for each of thephase shifted clock phases a respective third flip-flop, each of thethird flip-flops configured to, in response to the respective phaseshifted clock phase, sample a respective third control signal, therebydetermining a respective fourth control signal corresponding to asynchronized version of the respective third control signal. Forexample, each of the third flip-flops may be configured to sample therespective third control signal in response to a rising edge of therespective phase shifted clock phase.

Accordingly, as will be described in greater detail in the following,only one of the fourth control signals will be set, i.e., the fourthcontrol signals represent a one-hot encoding of the phase value.

Moreover, in case the reference clock signal is selected amongst thephase shifted clock phases as a function of a selection signal, thephase value may be determined as a function of the fourth controlsignals and the selection signal.

In general, the time measurement circuit may not only monitor thefractions of the clock cycle, but also the number of clock cycleselapsed since a given event. In this case, the time measurement circuitmay comprise a counter circuit configured to increase a count value inresponse to the reference clock signal, and a counter sampling circuitconfigured to generate a sampled count value by sampling the count valueof the counter circuit.

For example, in various embodiments, the counter sampling circuitcomprises:

-   -   a first sampling circuit configured to, in response to a rising        edge of the reference clock signal, sample the asynchronous        event signal, thereby generating a first synchronized        asynchronous event signal;    -   a second sampling circuit configured to, in response to a        falling edge of the reference clock signal, sample the        asynchronous event signal, thereby generating a second        synchronized asynchronous event signal; and    -   a sampling circuit configured to, in response to a rising edge        of the reference clock signal, store, as a function of the first        and the second synchronized asynchronous event signal, either        the count value of the counter circuit or the count value of the        counter circuit decreased by one, thereby generating the sampled        count value.

As mentioned before, such a time measurement circuit may be useful in asystem comprising a PWM signal generator circuit configured to generatea Pulse-Width Modulated signal, e.g., as a function of the count valueof the counter circuit, and optionally also the phase shifted clockphases. For example, in this case, the sampled count value and the phasevalue may be indicative of the number of clock cycles and the fractions1/n of clock cycles of the reference clock signal elapsed between anedge of the Pulse-Width Modulated signal and the instant when theasynchronous event signal was set.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

The embodiments of the present disclosure will now be described withreference to the drawings, which are provided purely to way ofnon-limiting example and in which:

FIG. 1 shows an example of a PWM signal;

FIG. 2 shows an example of a circuit generating multi-phase clocksignals;

FIG. 3 shows an example of the waveforms of clock phases provided by thecircuit of FIG. 2;

FIG. 4 shows an example of the fine tuning of the switch-on duration ofa PWM signal by means of multi-phase clock signals;

FIG. 5 shows an embodiment of the fine tuning of both the switch-onduration and the switch-off duration of a PWM signal by means ofmulti-phase clock signals;

FIGS. 6A and 6B show embodiments of a timer circuit in accordance withthe present disclosure;

FIG. 7 shows exemplary waveforms generated by the timer circuits ofFIGS. 6A and 6B;

FIG. 8 shows an embodiment of a PWM generator circuit;

FIGS. 9A, 9B, 10A, 10B, 10C, 11A, 11B, 12A, 12B, 12C and 12D showvarious details of the circuits of FIGS. 6A, 6B and 8;

FIG. 13 shows an embodiment of a timer circuit configured to determine asampled count value and sampled phase value in response to anasynchronous event;

FIG. 14 shows an embodiment of a count value sampling circuit configuredto determine a sampled count value in response to an asynchronous event;

FIGS. 15, 16 and 17 show details of the count value sampling circuit ofFIG. 14; and

FIGS. 18, 19 and 20 show an embodiment of a phase value sampling circuitconfigured to determine a sampled phase value in response to anasynchronous event.

DETAILED DESCRIPTION

In the ensuing description, various specific details are illustratedaimed at enabling an in-depth understanding of the embodiments. Theembodiments may be provided without one or more of the specific details,or with other methods, components, materials, etc. In other cases, knownstructures, materials, or operations are not shown or described indetail so that various aspects of the embodiments will not be obscured.

Reference to “an embodiment” or “one embodiment” in the framework ofthis description is meant to indicate that a particular configuration,structure, or characteristic described in relation to the embodiment iscomprised in at least one embodiment. Hence, phrases such as “in anembodiment,” “in one embodiment,” or the like that may be present invarious points of this description do not necessarily refer to one andthe same embodiment. Moreover, particular conformations, structures, orcharacteristics may be combined in any adequate way in one or moreembodiments.

The references used herein are only provided for convenience and hencedo not define the sphere of protection or the scope of the embodiments.

In FIG. 2 to 20 described below, parts, elements or components that havealready been described with reference to FIG. 1 are designated by thesame references used previously in these figures. The description ofthese elements has already been made and will not be repeated in whatfollows in order not to burden the present detailed description.

As explained in the foregoing, time measurement circuits (chronometers)configured to measure the time elapsed between a first (start) event anda second (stop) event may be useful in a variety of application, such asfor measuring the time elapsed between the rising and/or falling edge ofa PWM signal (representing a start event) and a given event generated inresponse to the rising or falling edge of the PWM signal. Generally, thesecond/stop event may thus be signaled via an asynchronous externalsignal.

Thus, before discussing embodiments of time measurement circuits, firstpossible solutions for generating PWM signals will be discussed.

As described with respect to FIG. 1, one of the simplest solutions forgenerating a PWM signal is based on an oscillator circuit generating aclock signal CLK and a counter configured to increase a count value inresponse to the clock signal CLK. Thus, by using a comparator circuitthe PWM signal may be generated as a function of the count valueprovided by the counter, e.g., by comparing the count value with giventhreshold values, e.g., indicative of the switch-on duration T_(ON) andthe switching period T_(SW).

However, in such a (digital) implementation, the accuracy and resolutionof the PWM signal is limited by the clock period T_(CLK) (samplingfrequency) of the clock signal CLK. Moreover, by increasing the clockfrequency F_(CLK)=1/T_(CLK) also the switching losses will increase.

However, in many applications, high resolution PWM signals are requiredor strongly preferred. For example, as mentioned before, PWM signals maybe used in many applications to control the average value of a voltageor current, such as for wireless battery chargers, switching mode powerconverters, motor control and lighting. For example, in suchapplications a half-bridge or full bridge may be used to drive aresonant tank, usually comprising one or more inductors and capacitors,wherein the electronic switches of the half-bridge or full bridge aredriven by means of PWM signals.

In order to miniaturize the equipment, small inductors may be usedleading to a high working frequency. Thus, often a high-frequencymodulated waveform PWM signal with high precise resolution should beprovided in order to keep power consumption at acceptable values. Forexample, in a switching power supply, the output voltage is oftendirectly proportional to the PWM duty cycle. The smaller is theadjustment to the duty cycle, the smaller is the resulting change to theoutput, i.e., a more precise control of the output voltage permits toachieve a better accuracy level and system stability. Moreover,minimizing output voltage ripple means reduce noise levels.

An alternative solution for generating a PWM signal, in particular aHigh Resolution (HR) PWM signal, is based on the use of multiple clockphases, i.e., phase-shifted clock signals having the same frequency.

For example, FIG. 2 shows a possible circuit for generating multipleclock phases ϕ₀..ϕ_(n), via a Delay Locked Loop (DLL).

Specifically, in the example considered the clock signal CLK generatedby an oscillator OSC is fed to a cascade of a plurality of (identical)delay stages DU₁..DU_(n). Specifically, in the example considered, thefirst phase ϕ₀ corresponds to the clock signal CLK, and the other phasesϕ₁..ϕ_(n) correspond to the output signals of the delay stagesDU₁..DU_(n).

In the example considered, each of the delay stages DU₁..DU_(n) has adelay T_(DU) being programmable/settable as a function of a (voltage orcurrent) control signal CTRL. For example, such delay stages DU having avariable delay may be implemented with an even number of inverters,wherein one or more of the inverters charges a respective capacitance,such as a parasitic capacitance, connected to the output of theinverter. In this case, the control signal CTRL may be indicative of thecurrent provided by the inverter to charge the respective capacitance,thereby varying the time until the following inverter switches.

In the example considered, the last phase ϕ_(n) (having a given delayT_(D)=n·T_(DU) with respect to the clock signal CLK) and the clocksignal CLK is provided to a phase detector PD. The output of the phasedetector PD is fed to a regulator CP having at least an I (Integral)component, such as a charge pump, wherein the regulator CP provides atoutput the control signal CTRL. Optionally the control signal CTRL maybe passed through a loop filter LF.

Thus, essentially, the negative feedback loop, implemented by the blocksPD/CP/LF, synchronizes in time the last phase ϕ_(n) with the clocksignal CLK. If the delay cells DU are identical, all the clock phasesϕ₁..ϕ_(n) will have the same frequency f_(CLK), but are phase shiftedwith respect to the preceding phase by a delay of T_(DU)=T_(CLK)/n.

Such multiple clock phases may also be provided by a Phase Locked Loop(PLL) comprising a Voltage Controlled Oscillator (VCO) comprising aring-oscillator with a plurality of delay stages, wherein the PLL islocked to the frequency of a clock signal CLK. Also in this case, alocking of the PLL may be obtained by varying the delay introduced bythe delay stages, e.g., by varying via a bias circuit the currentprovided by the inverter stages implementing such delay stages, untilthe oscillator signal at the output of the VCO corresponds to the clocksignal CLK. Thus, each delay stage of the VCO may provide a respectiveclock phase, which is phase shifted by a given fraction of the period ofthe clock signal CLK.

For example, FIG. 3 shows exemplary waveforms for the phases ϕ₁..ϕ₁₆ incase n=17, wherein the last phase ϕ₁₇=ϕ₀=CLK is not shown in the Figure.

Accordingly, as shown in FIG. 4, while a counter and respectivecomparator circuit may provide a coarse PWM signal (having a plurality kof clock cycles of the clock signal CLK), the additional clock phasesϕ₁..ϕ_(n) may be used to add a fine tuning to the coarse PWM signal,which essentially permits to add fractions T_(DU) of the clock signalCLK to the coarse PWM signal. For example, such a solution is describedin document U.S. Pat. No. 7,206,343 B2, the content thereof beingincorporated herein by reference for this purpose.

For example, the fraction may be added to the coarse PWM signal by:

-   -   directly combining, e.g., by using one or more logic (e.g., OR)        gates, the coarse PWM signal with a given selected clock phase        ϕ, or    -   as described in document U.S. Pat. No. 7,206,343 B2, indirectly        by passing the coarse PWM signal through additional delay stages        and combining the coarse PWM signal with the delayed PWM signal,        e.g., via a logic (e.g., OR) gate, wherein the additional delay        stages introduce the same delay T_(DU) as the delay stages        DU₁..DU_(n), e.g., by biasing the additional delay stages with        the same control signal CTRL as the delay stages DU₁..DU_(n).

Thus, assuming that the counter (and a respective comparator circuit)provides a coarse PWM signal having a switching period T_(SW)=i·T_(CLK)and a switch-on duration of T_(ON)=k·T_(CLK), with 0≤k≤i, the final PWMsignal may have a switching period T_(SW)=i·T_(CLK) and a switch-onduration T_(ON)=k·T_(CLK)+l·T_(CLK)/n, with 0≤l<n. Thus, the switch-onduration T_(ON) of the PWM signal may be selected by setting the integervalues of the parameters k and l. Thus, essentially the use of anadditional DLL or PLL permits to vary the switch-on duration T_(ON), orin general the duty cycle D, with a higher precision, while theswitching period T_(SW) remains constant.

However, in various embodiments, the PWM signal generator circuit mayalso be configured to receive a plurality of clock phases ϕ₀..ϕ_(n) andgenerate both the rising and the falling edges of the PWM signal as afunction of these clock phases ϕ₀..ϕ_(n), thereby controlling both thePWM duty cycle and the PWM frequency with a higher resolution.

FIG. 5 shows the general operation of a first embodiment.

In the embodiment considered, the PWM signal generator circuit receivesthe first clock phases ϕ₀ (and/or the last clock phase ϕ_(n)=ϕ₀) and theintermediate clock phases ϕ₁..ϕ_(n-1). In some embodiments, the PWMsignal generator circuit includes a multiphase clock generator thatgenerates the various clock phases, which may include any multiphaseclock generator configured to generate the clock phases describedherein. Possible solutions for generating such clock phases are alreadydescribed in the introduction of the present disclosure, and therelevant description applies in its entirety (see in particular thedescription of FIG. 2). That is, in some embodiments, the multiphaseclock generator circuit of various embodiments of the present disclosuremay be as described, for example, with respect to FIG. 2.

Moreover, in the embodiment considered, the PWM signal generator circuitis configured to generate a PWM signal, wherein:

-   -   the switching duration T_(SW) may be set to        T_(SW)=i·T_(CLK)+j·T_(CLK)/n; and    -   the switch-on time T_(ON) may be set to        T_(ON)=k·T_(CLK)+l·T_(CLK)/U.

In various embodiments, the parameters i, j, k and l integer values,wherein the parameters i, j, k and l may be programmable.

Specifically, in the example shown in FIG. 5, it is assumed that n=17,e.g., the PWM signal generator circuit receives the clock phasesϕ₀..ϕ₁₆, and the PWM signal generator circuit is configured to generatea PWM signal with:T _(SW) =i·T _(CLK)+10·T _(CLK)/17=T _(i)+10·T _(CLK)/17,

-   -   a duty cycle of 50% (i.e., T_(ON)=T_(OFF)=T_(SW)/2), i.e.,        T_(ON)=T_(OFF)=T_(i)/2+5·T_(CLK)/17.

In the example considered, it will be assumed for simplicity that i isan even number, and k=p=i/2.

Specifically, in the embodiment considered, the PWM signal generatorcircuit is configured to use during the first switch-on period T₁ thephase ϕ₀ as clock signal for the digital counter counting the timeperiod T_(i)/2=k·T_(CLK), and (as will be described in greater detail inthe following) the PWM signal generator circuit adds at the end afraction of 5/17 of the period T_(CLK) by using the phase ϕ₅.

However, instead of then tracking the accumulation of the variousfractions, the PWM signal generator circuit uses then during thefollowing switch-off period T₂ the phase ϕ₅ (i.e., the phase used to addthe fraction) as clock signal for the timer circuit (i.e., the digitalcounter counting the time period p·T_(CLK)) Moreover, the PWM signalgenerator circuit adds at the end again the respective fraction of 5/17of the period T_(CLK) by using in this case the phase ϕ₁₀, insofar asthe phase ϕ₁₀ is shifted by a delay of 5·T_(CLK)/17 with respect to thephase ϕ₅.

Next, the PWM signal generator circuit use during the second switch-onperiod T₃ the phase ϕ₁₀ as clock signal for the digital counter countingthe time period k·T_(CLK), and the PWM signal generator circuit adds atthe end a fraction of 5/17 of the period T_(CLK) by using this time thephase ϕ₁₅, insofar as the phase ϕ₁₅ is shifted by a delay of5·T_(CLK)/17 with respect to the phase ϕ¹⁰.

Similarly, the PWM signal generator circuit use during the followingswitch-off period T₄ the phase ϕ₁₅ as clock signal for the digitalcounter counting the time period p·T_(CLK), and the PWM signal generatorcircuit adds at the end a fraction of 5/17 of the period T_(CLK) byusing this time the phase ϕ₃, insofar as the phase ϕ₃ is shifted by adelay of 5·T_(CLK)/17 with respect to the phase ϕ₁₅.

This operation continues also for the following switch-on and switch offperiods.

In various embodiments, the PWM generator circuit is thus configured togenerate a PWM signal, wherein:

-   -   the switch-on duration corresponds to        T_(ON)=k·T_(CLK)+l·T_(CLK)/n; and    -   the switch-off duration corresponds to        T_(OFF)=p·T_(CLK)+q·T_(CLK)/n.

In various embodiments, the parameter n (number of delay stages/phase)is fixed at a hardware level. However, the number n could also beprogrammable, e.g., by using in FIG. 2 a given fixed number of delaystages (e.g., 32) and selecting the n-th phase (and not necessarily thelast one) as feedback signal provided to the phase detector PD. In fact,in this way, the control loop will still be locked to the n-th phaseϕ_(n), with T_(DU)=T_(CLK)/n.

Thus, in various embodiments, the timer circuit of the PWM signalgenerator circuit (comprising the counter circuit and the comparatorcircuit) is configured to:

-   -   during a switch-on period T_(ON), increase a count value from a        reset value until the count value reaches the integer value k;        and    -   during a switch-off period T_(OFF), increase a count value from        a reset value until the count value reaches the integer value p.

However, in general, the timer circuit may also monitor the switchingduration T_(SW), i.e., the timer circuit of the PWM signal generatorcircuit (comprising the counter circuit and the comparator circuit) maybe configured to:

-   -   during a switch-on period, increase a count value from a reset        value until the count value reaches the integer value k; and    -   during a switch-off period, increase the count value used during        the switch-on period until the count value reaches the integer        value i.

Thus, in various embodiments, the PWM signal generator circuit isconfigured to determine the parameters k/l, and at least one of p/q, andi/j wherein:

-   -   in case of a switch-on period T_(ON), k corresponds to the        integer number of clock cycles of the clock signal CLK and l        corresponds to the integer number of the fractions 1/n of a        clock cycle of the clock signal CLK;    -   in case of a switch-off period T_(OFF), p corresponds to the        integer number of clock cycles of the clock signal CLK and q        corresponds to the integer number of the fractions 1/n of a        clock cycle of the clock signal CLK; and    -   in case of a switching period T_(SW), i corresponds to the        integer number of clock cycles of the clock signal CLK and j        corresponds to the integer number of the fractions 1/n of a        clock cycle of the clock signal CLK.

Specifically, in view of the above definitions:T _(ON) k·T _(CLK) +l·T _(CLK) /n  (2)T _(OFF) p·T _(CLK) +q·T _(CLK) /n  (3)T _(SW) =T _(ON) +T _(OFF) =i·T _(CLK) +j·T _(CLK) /n  (4)the integer values i and j are related to the integer values k, l, p andq according to the following equations:

-   -   in case (l+q)<n (without overflow):        i=k+p;j=l+q;  (5)    -   in case (l+q)>n (with overflow):        i=k+p+1;j=l+q−n.  (6)

Thus, in various embodiments, the PWM generator circuit is configured toreceive at least two of the parameters i, k and p, and at least two ofthe parameters j, l and q. For example, the PWM signal generator circuitmay directly receive the parameters k/l and/or p/q and/or i/j, such as:

-   -   data identifying (e.g., corresponding to) the parameters k/l;        and    -   data identifying (e.g., corresponding to) the parameters p/q.

Alternatively, the PWM signal generator circuit may receive other datapermitting a calculation of these parameters according to equations (5)and (6), such as:

-   -   data identifying the switching duration T_(SW), such as the        above-mentioned parameters i and j, and one of:        -   data identifying (e.g., corresponding to) the parameters            k/l;        -   data identifying (e.g., corresponding to) the parameters            p/q; or        -   data identifying the duty cycle

As shown in FIG. 6A, in various embodiments, the PWM signal generatorcircuit comprises a timer circuit 102 comprising a digital countercircuit 104 configured to vary (i.e., increase or decrease) an integercount value CNT in response to a clock signal CLK_TMR and a comparatorcircuit 106 configured to compare the count value CNT with a respectiveinteger comparison threshold.

As shown in FIG. 6A, the same counter 104 and comparator 106 may be usedfor both the switch-on period and the switch-off period by selecting,e.g., via a multiplexer 108, the parameter k or p as comparisonthreshold. Accordingly, by resetting the counter 104 via the signal atthe output of the comparator 106, the same counter 104 may be used tomonitor the switch-on period and the switch-off period. However, thecounter 104 may also be used to monitor the switch-on period and theduration T_(SW). For example, in this case, the multiplexer 108 mayreceive the parameters k and i, and the counter 104 may only be resetwhen the count value CNT reaches the value i.

Alternatively, as shown in FIG. 6B, a respective counter 104 a and 104 band comparator 106 a and 106 b may be used for the switch-on period andthe switch-off period, wherein the comparator 106 a compares a countvalue CNTa provided by the counter 104 a with the parameter k and thecomparator 106 b compares a count value CNTb provided by the counter 104b with the parameter p.

In various embodiments, the timer circuit 102 is configured to generateone or more trigger signal when the output of the comparator indicatesthat the count value has reached the comparison threshold, e.g., byusing a signal EOC_TMR at the output of the comparator 106, orrespective signal EOC_TMRa and EOC_TMRb at the outputs of thecomparators 106 a and 106 b.

In the embodiments considered, the signal EOC_TMR (FIG. 6A) or thesignals EOC_TMRa and EOC_TMRb (FIG. 6B) are provided to a controlcircuit 110 with selects the clock signal CLK_TMR for timer circuit 102,in particular the counter 104 (104 a/104 b), as a function of:

-   -   during a switch-on period, the parameter l; and    -   during a switch-off period, the parameter q.

Specifically, even when monitoring the end of the switching durationT_(SW), it is preferably to obtain, e.g., calculate according toequations (5) and (6), the parameter q, because this parameter indicatesthe additional fractions which have to be added with respect to theprevious switch-on period.

For example, the control circuit 110 may select the clock signal CLK_TMRby driving via a selection signal SEL1 a multiplexer 100 receiving atinput the clock phases ϕ₀..ϕ_(n-1). Similarly, the control signal maydrive via a selection signal SEL2 a multiplexer 112 in order to selecteither the parameter l or the parameter q, i.e., the selection signalindicates whether the current period is a switch-on period or aswitch-off period, and may thus also be used to drive the multiplexer108.

Specifically, in various embodiments, in response to a trigger in thesignal EOC_TMR (FIG. 6A) or the signals EOC_TMRa and EOC_TMRb (FIG. 6B),the control circuit 110 is configured to change the logic value of theselection signal SEL1:

-   -   during a switch-on period, as a function of the parameter l; and    -   during a switch-off period, as a function of the parameter q.

Specifically, in various embodiments, the control circuit also performsa modulo operation in order to maintain the selection signal SEL1between 0 and n−1. Accordingly, in response to a trigger in the signalEOC_TMR (FIG. 6A) or the signals EOC_TMRa and EOC_TMRb (FIG. 6B), thecontrol circuit 110 varies the selection signal SEL1:

-   -   during a switch-on period, SEL1=(SEL1+l) mod n; and    -   during a switch-off period, SEL1=(SEL1+q) mod n.

Thus, essentially, the control circuit 110 implements a phaseaccumulator circuit, which adds to the currently selected phase either lor q, wherein the parameters q may be calculated, e.g., as shown inequations (5) and (6) as a function of the parameters j and n.

Finally, in various embodiments, the respective period (either aswitch-on or switch-off period) is terminated and the following periodis started with the next clock pulse (i.e., with the next rising orfalling edge based on which type of edge is used by the timer circuit102) of the selected clock phase.

Thus essentially, during a switch-on period T_(ON) the trigger signalEOC_TMR (or EOC_TMRa) is generated after a time k·T_(CLK), and bychanging the clock signal CLK_TMR the switch-on period is terminated,thereby starting the following switch-off period, after an additionaltime l/n·T_(CLK). Similarly, during a switch-off period T_(OFF) thetrigger signal EOC_TMR (or EOC_TMRb) is generated after a time p·T_(CLK)(which may be obtained, e.g., by resetting the counter 104 and waitingfor p cycles or by waiting until the count value reaches i), and bychanging the clock signal CLK_TMR the switch-off period is terminated,thereby starting the following switch-on period, after an additionaltime q/n·T_(CLK).

For example, this is shown in FIG. 7, wherein during a switch-on period,the timer circuit uses a clock phase CLK_TMR=ϕ_(x), and the triggersignal EOC_TMR is set after, e.g., k=9 periods of the phase ϕ_(x), e.g.,with the 10^(th) rising edge. In response to the trigger signal EOC_TMR(EOC_TMRa) the control circuit selects a new phase CLK_TMR=ϕ_(y) (withy=(x+l) mod n). Moreover, in response to the immediately following(e.g., rising) edge in the signal ϕ_(y), the PWM signal generatorcircuit terminates the switch-on period and starts the followingswitch-off period, thereby introducing an additional time correspondinga fraction l/n of the clock period.

In the embodiment considered, during the following switch-off period,the timer circuit uses then the clock phase CLK_TMR=ϕ_(y), and thetrigger signal EOC_TMR is set after, e.g., p=8 periods of the phaseϕ_(y), e.g., with the 9^(th) rising edge. In response to the triggersignal EOC_TMR (EOC_TMRb) the control circuit selects a new phaseCLK_TMR=ϕ_(z) (with z=(y+q) mod n). In response to the immediatelyfollowing (e.g., rising) edge in the signal ϕ_(z), the PWM signalgenerator circuit terminates the switch-off period and starts thefollowing switch-on period, thereby introducing an additional timecorresponding a fraction q/n of the clock period.

In the previous embodiments, the control circuit 110 is configured todrive the selection circuit 100 in order to changes the phase ϕ assignedto the clock signal CLK_TMR from the current phase (t) (e.g., ϕ₀) to thenext phase ϕ(t+1) (e.g., ϕ₅) in response to the signal EOC_TMR, therebyadding the fractions (l or q) at the end of the respective switch-on orswitch-off period.

However, in various embodiments, the switching from the current phaseϕ(t) to the next phase ϕ(t+1) may occur at any instant during therespective period. In this case, the control unit 110 may also beconfigured to either increase/decrease sequentially, e.g., in responseto the clock signal CLK_TMR, the selection signal SEL1 from the oldphase ϕ(t) to the new phase ϕ(t+1) (e.g., ϕ₀, ϕ₁, ϕ₂, ϕ₃, ϕ₄, ϕ₅) or byswitching directly to the new phase ϕ(t+1).

Generally, while reference has been made to periods of the clock signalCLK, indeed the phases ϕ₀ . . . ϕ_(n-1) may also have a different clockperiod T_(PLL), e.g., the frequency f_(PLL)=1/T_(PLL) may be a multipleof the clock frequency f_(CLK), e.g., by using a frequency divider inthe feedback loop of the phase ϕ_(n-1). Accordingly, in general:

-   -   the switch-on duration corresponds to        T_(ON)=k·T_(PLL)+l·T_(PLL)/n; and    -   the switch-off duration corresponds to        T_(OFF)=p·T_(PLL)+q·T_(PLL)/n.

FIG. 8 shows a second embodiment of a PWM signal generator circuit.

Specifically, in the embodiment considered, the PWM signal generatorcircuit comprises again a timer circuit 102, a clock switching circuit100′ and a control circuit/phase accumulator 110′.

Specifically, with respect to FIGS. 6A and 6B, the clock switchingcircuit 100′ is not implemented with a mere multiplexer, but with acircuit which directly generates, in response to the trigger signalEOC_TMR provided by the timer circuit 102, the clock signal CLK_TMR forthe timer circuit as a function of the selection signal SEL1 provided bythe control circuit 110′. Generally, as described in the foregoing, alsoany other trigger signal may be used to assign to the clock signalCLK_TMR a new clock phase as a function of the selection signal SEL1.

For example, a possible embodiment of the clock switching circuit 100′is shown in FIGS. 9A and 9B.

In the embodiment considered, the selection signal SEL1 (indicative ofthe next clock phase), is provided to a series of optional latches 1000configured to store the value of the signal SEL1 in response to thetrigger signal EOC_TMR. Substantially, these latches 1000 ensure thatthe circuit samples the value of the signal SEL1 only when a trigger inthe signal EOC_TMR is generated.

In the embodiment considered, each clock phase ϕ₀ . . . ϕ_(n-1) isprovided to a respective transmission gate (gated clock cells) 1002 ₀ .. . 1002 _(n) being enabled as a function of the selections signal SEL1or optionally the latched selections signal SEL1, thereby generatingrespective (gated) signals ϕ_(0_gtd) . . . ϕ_(n-1_grtd). For example, invarious embodiments, the selection signal comprises (n) bits SEL₀ . . .SEL_(n-1) and uses a one-hot encoding, wherein a given bit is associatedunivocally with a given clock phase ϕ₀ . . . ϕ_(n-1), i.e., only one ofthe bits SEL₀ . . . SEL_(n-1) is set and indicates that the respectiveclock phase ϕ₀ . . . ϕ_(n-1) may pass through the respectivetransmission gate 1002 ₀ . . . 1002 _(n-1), while the other clock phasesϕ₀ . . . ϕ_(n-1) cannot pass through the respective transmission gates1002 ₀ . . . 1002 _(n-1). In general, also other encoding schemes may beused for the selection signal (such as a binary encoding), and thetransmission gates may be driven via a decoder circuit configured togenerate the one-hot encoded drive signals for the transmission gates1002 ₀ . . . 1002 _(n-1) as a function of the selection signal SEL1.

As shown in FIG. 9B, the signals ϕ_(0_gtd) . . . ϕ_(n-1_gtd) are thenprovided to a combinational logic circuit 1004 configured to generate atoutput the clock signal CLK_TMR for the timer circuit 102 by combiningthe signals ϕ_(0_gtd) . . . ϕ_(n-1_gtd). For example, in variousembodiments the signals ϕ_(0_gtd) . . . ϕ_(n-1_gtd) are combined via alogic OR operation, e.g., implemented with a cascaded structure of aplurality of OR gates OR1, OR2, OR3, etc.

FIG. 10A shows the operation of the clock switching circuit 100′ at theexample of a selection signal SEL1 having in sequence the value k, x andy, thereby activating (in response to the trigger signal EOC_TMR) insequence the clock phases ϕ_(k_gtd), ϕ_(x_gtd) and ϕ_(y_gtd).

Thus, in case the selection signal SEL1 changes, the clock signalCLK_TMR switches from a first clock phase to a second clock phase inresponse to the selection signal.

Specifically, as shown in FIG. 10B, when the second clock phase(ϕ_(x_gtd)) goes to high (rising edge), while the first clock phase(ϕ_(k_gtd)) is still high, the resulting clock signal CLK_TMR will havea single clock pulse with a duration being greater than the clock periodT_(PLL) of the clock phases ϕ₀ . . . ϕ_(n-1), thereby essentially losinga clock cycle.

Usually this occurs when the respective fraction l or q is smaller thann/2.

Conversely, as shown in FIG. 10C, when the second clock phase(ϕ_(y_gtd)) goes to high (rising edge), while the first clock phase(ϕ_(x_gtd)) is low, the resulting clock signal CLK_TMR will have asingle clock pulse, with a duration being smaller than the clock periodT_(PLL) of the clock phases ϕ₀ . . . ϕ_(n-1). Usually this occurs whenthe respective fraction l or q is greater than n/2.

Thus, the lost clock edge (FIG. 10B) should be taken into account inorder to correctly determine the duration of the respective timeinterval. Specifically, in various embodiments, in case a clock cycle islost, i.e., the respective fraction l or q is smaller than n/2, the PWMsignal generator circuit is configured to increase the timer circuit 102by an additional clock cycle, i.e., the timer 102 is increase by 2 andnot only 1 for a single clock cycle.

FIG. 11A shows a possible embodiment of the timer circuit 102.

Specifically, in the embodiment considered, the counter 104 isimplemented with an accumulator comprising:

-   -   a register 1040 providing at an output the count value CNT,        wherein the register 1040 is configured to store a signal REG_IN        at a respective input in response to the clock signal CLK_TMR;        and    -   a digital adder 1042, configured to generate the signal REG_IN        at the input of the register 1040 by adding an increment value        INC to the count value CNT.

In the embodiment considered, the increment value INC may be set eitherto “1” or “2,” e.g., via a multiplexer 1044. Specifically, the selectionis driven via a selection signal SEL3 provided by the control circuit110 (or similarly by the control circuit 110′).

Specifically, in the embodiment considered, the control circuit 110comprises:

-   -   a digital comparator 1100 configured to determine whether the        fraction value l or q of the current switch-on or switch-off        period is greater than n/2; and    -   a circuit 1102 configured to generate a selection signal SEL3 as        a function of the comparison signal generated by the comparator        1100 and a trigger signal indicating the start of a new        switch-on or switch-off period, such as the signal EOC_TMR or,        in the general case, as a function of the comparison signal        generated by the comparator 1100 and a generic trigger signal        whose length is one CLK_TMR cycle and generated in any        appropriate instant during the switch-on or switch-off period.

Specifically, in the embodiment considered, the multiplexer 112 alreadyprovide the fraction value for the current period, wherein the selectionsignal SEL2 indicates whether the current period is a switch-on orswitch-off period. Accordingly, the comparator 1100 may receive at inputthe signal provided by the multiplexer 112 and thus generates acomparison signal indicating whether the fraction value l or q isgreater than n/2. Specifically, the circuits 110 and 112 are configured:

-   -   when the signal at the output of the comparator indicates that        the fraction l or q (based on the current period) is greater        than n/2 or the trigger signal (e.g., EOC_TMR) is not set, drive        the multiplexer 1044 via the signal SEL3 in order to selected        the value “1,” whereby the accumulator 1040/1042 is increased in        response to the clock signal CLK_TMR by “1”; and    -   when the signal at the output of the comparator indicates that        the fraction l or q (based on the current period) is smaller        than n/2 and the trigger signal (e.g., EOC_TMR) is set, drive        the multiplexer 1044 via the signal SEL3 in order to selected        the value “2,” whereby the accumulator 1040/1042 is increased in        response to the clock signal CLK_TMR by “2.”

Accordingly, substantially, the timer circuit 104 is configured toincrease for one clock cycle of the signal CLK_TMR (i.e., a single cyclefor each switch-on or switch-off period) the count value by two (“2”)when the fraction l or q (based on the current period) is smaller thann/2.

Conversely, FIG. 11B shows that a similar result may be obtained byadapting directly the threshold value used by the comparator 106.

Specifically, in the embodiment considered, the increment value INC isalways set to “1,” and an additional digital subtractor is providedwhich is configured, e.g., via a multiplexer 1048, to:

-   -   subtract the value “1” from the current threshold selected by        the multiplexer 108 (k or p); or    -   maintain the threshold value, e.g., by subtracting the value “0”        from the current threshold selected by the multiplexer 108 (k or        p).

In general, the embodiments may also be combined, i.e., during aswitch-on duration may be implemented either the “plus-two” mechanism(FIG. 11A) or the adaption of the threshold k (FIG. 11), and during aswitch-off duration may be implemented either the “plus-two” mechanismor the adaption of the threshold p.

Accordingly, in the embodiments considered, the circuits 1100/1102inform the timer circuit 102 that a counting edge has been missed orwill be missed due to clock combination shown in FIG. 9B. This missingedge information (i.e., the signal SEL3) can be computed by the controlcircuit/phase accumulator machine 110/110′ that controls the fine delayselection and generates the phase selection change SEL1 (indicative ofthe next clock phase to be used for fine tuning of PWM signal). In fact,if the new phase selection selects a clock having its rising edgeappearing during the on-time of the running clock, the combined CLK_TMRwill have a longer on-time and the edge of the next selected clockphase, used in the clock combination circuitry of FIG. 9B, will bemissed. This happens if the phase selection change is smaller than thehalf of number of available phases i.e., this occurs when the respectivefraction l or q is smaller than n/2 (e.g., └17/2┘=8).

Using this clock change property, the timer may be incremented by “1” or“2,” or the threshold of the comparator 106 may be adapted with respectto this internal flag generated as shown in FIG. 11A or 11B.

In various embodiments, the PWM signal is switched in response to thenext rising edge of the new clock phase, i.e., the selected clock phaseϕ_(0_gtd) . . . ϕ_(n-1_gtd) of the following switch-on or switch-offperiod. However, the PWM signal may also be changed in response to therising edge of the trigger signal EOC_TMR in the case of a SEL1 signalgenerated in any appropriate instant during the given time slot/period.

For example, as shown in FIG. 8, the PWM signal generator circuit maycomprise a toggle circuit 114 configured to generate the PWM signal as afunction of the signals ϕ_(0_gtd) . . . ϕ_(n-1_gtd) and the triggersignal EOC_TMR.

Generally, any suitable circuit may be used to toggle the level of thePWM signal in response to the signal EOC_TMR (or EOC_TMRa and EOC_TMRb)and the new clock phase.

For example, FIG. 12A shows an embodiment of the toggle circuit 114.Specifically, the toggle circuit 114 comprise arising edged detectorcircuit. Specifically, in the embodiment considered, the toggle circuitcomprises for each of the signals ϕ_(0_gtd) . . . ϕ_(n-1_gtd) arespective rising edge detector 1140 ₀..1140 _(n-1), which is enabled asa function of the signal EOC_TMR.

Specifically, as shown in FIGS. 12B, 12C and 12D, in response to therising edge of the current clock phase (e.g., ϕ_(k_gtd) in FIG. 12C),the signal EOC_TMR will be set after a brief delay. In response to thetrigger in the signal EOC_TMR, the circuit 100′ will switch to the newclock phase (e.g., ϕ_(x_gtd) in FIG. 12C). Thus, no additional risingedge of the old clock signal (e.g., ϕ_(k_gtd) in FIG. 12C) occurs. Thus,in response to the following rising edge in the new clock phase (e.g.,ϕ_(x_gtd) in FIG. 12C) the respective edge detector 1140 will set itsoutput (e.g., to high), because also the signal EOC_TMR is still set.

Accordingly, in the embodiment considered, the output of the variousrising edge detector 1140 ₀..1140 _(n-1) may be connected to acombinational logic circuit, e.g., implementing a logic OR function(FIG. 12A shows schematically a logic OR gate OR4, that may correspondto the last OR gate of a chain of OR gates, e.g., comprising in cascade6 OR gates having three inputs, 2 OR gates having 2 inputs and the ORgate OR4) for this purpose but, generally speaking, it can beimplemented with a different number and topology of gates as a result ofa different balancing process with respect to speed and to the number ofclock phases), which generates at output a trigger signal TRIGindicating that the logic level of the PWM signal has to change.

Accordingly, in the embodiment considered, the signal TRIG may be usedto drive a flip-flop FF1 in order to invert the output of the flip-flopFF1, wherein the PWM signal is generated as a function (and preferablycorresponds to) the signal at the output of the flip-flop FF1.

For example, in the embodiment considered, the flip-flop FF1 isimplemented with a D-type flip-flop, receiving at the data terminal Dvia an inverter INV1 the inverted output signal of the flip-flop FF1,thereby inverting the output of the flip-flop FF1 in response to thetrigger signal TRIG.

The inventor has observed that the above described clock signal CLK_TMRmay also be used to implement a (high resolution) chronometer, i.e., atimer circuit configured to generate a signal indicative of the timeelapsed between a start event and a stop event.

Specifically, as described in the foregoing, PWM signals are often usedto control the average value of a voltage or current. For example, PWMsignals are often used in wireless battery chargers, switched mode powersupplies (electronic converters), motor control and lighting. Forexample, a chronometer may be useful when the PWM signal is used todrive (e.g., via a half or full bridge) a resonant circuit comprisingone or more inductances and capacitances, e.g., a LC resonant tank. Forexample, a typical application may be a wireless power transmitter, oran electronic converter. For example, in this application it may beuseful to measure the time elapsed between the rising and/or fallingedge of the PWM signal and a given event (generated in response to therising or falling edge of the PWM signal). For example, the chronometermay measure the time elapsed between the rising edge of the PWM signaland the instant when a current flowing through a given component of theresonant tank or the voltage at a given component or node of theresonant tank reaches a given threshold value, e.g., the current flowingthrough or the voltage at one of the components of the LC resonant tank,such as the voltage at a ringing node of the LC resonant tank.

The inventor has observed that the above described coarse counter(s) 104or 104 a/104 b and the phase signals ϕ₀ . . . ϕ_(n-1) may be used tocapture, in response to a given asynchronous event, with high resolutionthe time information of the PWM signal generator circuit.

Specifically, in various embodiments, the chronometer circuit isconfigured to store, in response to such an asynchronous event, the timeand/or the phase information in a coherent way (e.g., with respect tothe rising or falling edge of the PWM signal and the n phases outgoingfrom the PLL), with high resolution, minimum latency and withoutmetastability issues.

Specifically, in the previous embodiments, the counter(s) 104 or 104a/104 b are controlled by an adaptive clock CLK_TMR corresponding to asingle selected clock phase, and a different clock phase may be used forthe next interval T_(ON) or T_(OFF), thereby applying a fine tuning.Thus, the chronometer should sample the time, e.g., in terms of numberof clock cycles and the phase information.

FIG. 13 shows a first embodiment of a circuit 30 configured to determinea count value CV and a phase value PV in response to an asynchronousevent, e.g., a rising (and/or falling) edge in a signal AE.

As mentioned before, such an asynchronous event signal AE may begenerated via a comparator circuit 300 configured to compare an analog(voltage or current) signal with a respective threshold value TH.

Specifically, in the embodiment considered, the circuit 30 receives aplurality of phase signals ϕ₀ . . . ϕ_(n-1) and a count value CNT from acounter 104.

In the embodiment considered, the asynchronous event signal AE issampled via a synchronization chain, e.g., implemented with two (ormore) flip-flops FFa and FFb connected in cascade. Specifically, in theembodiment considered, the asynchronous event signal AE issampled/synchronized with each of the phase signals ϕ₀ . . . ϕ_(n-1),i.e., the circuit 30 comprises for each phase signal ϕ₀ . . . ϕ_(n-1) arespective synchronization chain FFa₀/FFb₀, FFa₁/FFb₁, . . . configuredto sample the asynchronous event signal AE in response to a respectivephase signal ϕ₀ . . . ϕ_(n-1), thereby generating respectivesampled/synchronized versions AE₀, AE₁, . . . of the asynchronous eventsignal AE.

In the embodiment considered, one of the synchronized signals AE₀, AE₁,. . . (e.g., the signal AE₀) is provided to a register 301 in order tostore the count value CNT of the counter 104 (or similarly the countvalue CNTa of the counter 104 a or the count value CNTb of the counter104 b), thereby providing at output the count value CV.

Moreover, the various synchronized versions AE₀, AE₁, . . . are providedto a circuit 302, preferably a combinational logic circuit, which isconfigured to generate the phase value PV as a function of the(instantaneous) logic values of the synchronized signals AE₀, AE₁, . . ..

However, the inventor has observed that storing separately the countervalue CNT and the phase state (as indicated by the signals AE₀, AE₁, . .. ) may result in incorrect counter and phase pairing, e.g., due tometastability and different path timing. For example, even when usingsynchronization chains, the signals AE₀, AE₁, . . . have to be combinedand the operation should be synchronized also with the clock signalCLK_TMR of the counter 104.

FIGS. 14 and 19 shows a second embodiment of a circuit configured todetermine the count value CV and/or the phase value PV in response to anasynchronous event signal AE.

Specifically, FIG. 14 shows an embodiment of a circuit 30 a configuredto determine the count value CV.

Specifically, in the embodiment considered, the circuit 30 a comprisestwo synchronization stages 304 and 306. For example, each of thesynchronization stages 304 and 306 may be implemented with one or moreflip-flops.

Specifically, in the embodiment considered, the synchronizationstage/flip-flop 306 is configured to sample the asynchronous eventsignal AE at each rising edge of the clock signal CLK_TMR, e.g., theclock signal CLK_TMR is connected to the clock input of thesynchronization stage/flip-flop 306, thereby generating a firstsynchronized event signal AE_rs, and the synchronization stage/flip-flop304 is configured to sample the asynchronous event signal AE at eachfalling edge of the clock signal CLK_TMR, which is schematically shownby a inverter INV providing an inverted version of the clock signalCLK_TMR to the clock input of the synchronization stage/flip-flop 304,thereby generating a second synchronized event signal AE_fl.

For example, FIG. 16 shows an embodiment of a VHDL code of the twosynchronization circuits 304 and 306.

Specifically, a process “p_async_fllng” models the behavior of thecircuit 304 and a process “p_async_rsng” models the behavior of thecircuit 304.

Generally, the process “p_async_fllng” is configured to assign to asignal ASYNCH_evnt_ret_fl (representing the signal AE_fl at the outputof the circuit 304) the value of the signal CMP_ASYNCH_evnt(corresponding to the asynchronous event signal AE) in response to afalling edge of the clock signal CLK_TMR (indicated by the conditionCLK_TMR′event and CLK_TMR=‘0’). Similarly, the process “p_async_rsng” isconfigured to assign to a signal ASYNCH_evnt_ret_rs (representing thesignal AE_rs at the output of the circuit 306) the value of the signalCMP_ASYNCH_evnt (corresponding to the asynchronous event signal AE) inresponse to a rising edge of the clock signal CLK_TMR (indicated by thecondition CLK_TMR′event and CLK_TMR=‘1’).

In various embodiments, the circuits 304 and 306 may also support areset operation. For example, in FIG. 16, the process “p_async_fllng” isconfigured to reset the signal ASYNCH_evnt_ret_fl when a signals_rst_dump (representing the reset signal) is set. Similarly, theprocess “p_async_rsng” may be configured to reset the signalASYNCH_evnt_ret_rs when the signal s_rst_dump is set.

In the embodiment shown in FIG. 14, the signals at the output of thesynchronization stages/flip-flops 304 and 306 are provided to a samplingcircuit 308 configured to store the count value CNT (or similarlyCNTa/CNTb) of the counter 104 in response to the clock signal CLK_TMRalso taking into account the logic values of the signalsAE_rs/ASYNCH_evnt_ret_rs and AE_fl/ASYNCH_evnt_ret_fl.

In the embodiment considered, at least one of the signalsAE_rs/ASYNCH_evnt_ret_rs and AE_fl/ASYNCH_evnt_ret_fl will be set by thecircuits 304/306 when an asynchronous event AE is signaled.

Specifically, as shown in FIG. 15, when the counter value CNT isincreased at each rising edge of the clock signal CLK_TMR, a given delayexists until the counter value CNT changes.

Thus, when an asynchronous event AE occurs while the clock signalCLK_TMR is high (e.g., instant t₂ in FIG. 14), the signalAE_fl/ASYNCH_evnt_ret_fl will be set to high with the next falling edgeof the clock signal CLK_TMR. Thus, when sampling the count value CNT atthe next rising edge of the clock signal CLK_TMR, the signalAE_rs/ASYNCH_evnt_ret_rs will still be set to low (due to the intrinsicpropagation delays).

Conversely, when an asynchronous reset AE occurs while the clock signalCLK_TMR is low (e.g., instant t₁ in FIG. 14), indeed the event occurs ata count value CNT−1 with respect to the instant t₃ when the count valueis sampled. However, in this case, the signal AE_rs/ASYNCH_evnt_ret_rswill be set to high with the next rising edge of the clock signalCLK_TMR and the signal AE_fl/ASYNCH_evnt_ret_fl will be set to high withthe next falling edge of the clock signal CLK_TMR. Thus, when samplingthe count value CNT at the next rising edge of the clock signal CLK_TMR,the circuit 30 a should indeed sample the value CNT−1.

Thus, in various embodiments, the circuit 30 a is configured to:

-   -   when the signal AE_rs/ASYNCH_evnt_ret_rs is low and the signal        AE_fl/ASYNCH_evnt_ret_fl is high, sample the count value CNT, in        response to the rising edge of the clock signal CLK_TMR; and    -   when the signal AE_rs/ASYNCH_evnt_ret_rs is high and the signal        AE_fl/ASYNCH_evnt_ret_fl is high, sample the count value CNT−1,        in response to the rising edge of the clock signal CLK_TMR.

For example, FIG. 17 shows an embodiment of a VHDL code of the circuit308, wherein a process “p_counter_dump” models the respective behavior.

For example, in the embodiment considered, in response to rising edge ofthe clock signal CLK_TMR (indicated by the condition CLK_TMR′event andCLK_TMR=‘1’) the circuit 310 verifies the logic values of the signalsASYNCH_evnt_ret_rs (AE_rs) and ASYNCH_evnt_ret_fl (AE_fl). In case, thesignals ASYNCH_evnt_ret_rs (AE_rs) and ASYNCH_evnt_ret_fl (AE_fl) arehigh, the circuit stores to a signal s_tmrcnt_dmp (representing thecount value CT) the value TMR_CRS−1 (representing the value CNT−1).Conversely, the signal ASYNCH_evnt_ret_rs (AE_rs) is low andASYNCH_evnt_ret_fl (AE_fl) is high, the circuit stores to a signals_tmrcnt_dmp (representing the count value CV) the value TMR_CRS (CNT).

In various embodiments, the circuit 308 may also support a sample enablesignal. For example, in FIG. 16, the process “p_counter_dump” isconfigured to store the value TMR_CRS−1 or TMR_CRS only when a sampleenable signal s_end_dump has a given logic level (e.g., low, asindicated by the condition s_end_dump=‘0’). Moreover, once having storedthe value TMR_CRS−1 or TMR_CRS, the logic value of this signal isinverted (e.g., high, as indicated by the operation s_end_dump<=‘1’).

In various embodiments, the circuit 308 may be configured to reset thesignals s_tmrcnt_dmp and s_end_dump when a signal s_rst_dump(representing again a reset signal) is set.

Thus, in various embodiments, the circuit 30 a is configured to receivea clock signal CLK_TMR, such as the clock signal CLK_TMR described withrespect to the PWM generator circuit of FIGS. 5 to 12, wherein thisclock signal is used to increase a counter 104. A first synchronizationcircuit 304 is used to synchronize/retime the asynchronous event signalAE in response to a falling edge of clock signal CLK_TMR, therebygenerating a first signal AE_fl. A second synchronization circuit 306 isused to synchronize/retime the asynchronous event signal AE in responseto a rising edge of clock signal CLK_TMR, thereby generating a firstsignal AE_rs.

A sampling circuit 308 elaborates the signals AE_fl and AE_rs, e.g., viaa combinational logic circuit, to determine:

-   -   whether an asynchronous event AE occurred; and    -   based on the signals AE_fl and AE_rs, whether the asynchronous        event AE occurred while the clock signal CLK_TMR was high or        low.

In case, both signals AE_fl and AE_rs are high, the counter value CNT isstored as signal CV, and if only the signal AE_fl is high, the countervalue CNT minus one (CNT−1) is stored as signal CV.

As mentioned before, FIG. 19 shows a circuit 30 b configured to performa phase detection/sampling.

In the embodiment considered, the circuit 30 b comprises a first levelof n flip flops FFa₀..FFa_(n-1), wherein each of the flip flopsFFa₀..FFa_(n-1) is configured to sample a respective clock phase ϕ₀ . .. ϕ_(n-1) (i.e., the respective phase ϕ_(i), with 0≤i≤(n−1), is appliedto the data input of the flip-flop FFa_(i)) in response to theasynchronous event signal AE (i.e., the asynchronous event signal AE isapplied to the clock input of the flip-flop FFa_(i)).

In the embodiment considered, the circuit 30 b comprises a second levelof n flip flops FFb₀..FFb_(n-1), configured to store the signal at theoutput of a respective one of the flip-flops FFa₀..FFa_(n-1) in responseto the falling edge of the respective phase ϕ₀ . . . ϕ_(n-1), i.e., theoutput of a given flip-flop FFa_(i) is applied/coupled to the data inputof a respective flip-flop FFb_(i) and the inverted version of therespective clock phase ϕi (schematically shown via invertersINV₀..INV_(n-1)) is applied to the clock input of the flip-flop FFb₁,thereby generating respective signals CMP_PH(0) . . . CMP_PH(n−1) at theoutput of the flip-flops FFb₀..FFb_(n-1).

Specifically, in various embodiments, the flip-flops FFb₀..FFb_(n-1) areconfigured to store only the signal at the output of the respectiveflip-flop FFa₀..FFa_(n-1), when the signal at the output of therespective flip-flop FFa₀ . . . FFa_(n-1) is high. Accordingly, once thesignal at the output of a flip-flop FFa_(i) is set to high, the outputat the respective flip-flop FFb_(i) is set to high in response to thenext falling edge of the respective phase ϕ_(i), and the output of theflip-flop FFb_(i) remains high also when the signal at the output of aflip-flop FFa_(i) is set to low. For example, in FIG. 19 is shownschematically for this purpose for each flip-flop FFb₀..FFb_(n-1) arespective logic OR gate OR₀..OR_(n-1), wherein each logic OR gateOR_(i) receives at input the signal at the output of the respectiveflip-flop FFa_(i) and the signal at the output of the respectiveflip-flop FFb_(i), and the output of the logic OR gate OR_(i) isconnected to the input of the respective flip-flop FFb_(i).

In the embodiment considered, the circuit 30 b comprises also a thirdlevel of n flip flops FFc₀..FFc_(n-1), configured to store, in responseto a rising edge of a respective phase ϕ₀ . . . ϕ_(n-1), the result ofthe comparison between two adjacent signals CMP_PH(0) . . . CMP_PH(n−1)at the output of the flip-flops FFb₀..FFb_(n-1). Specifically, a givenflip-flop FFc_(i) receives at the clock input the respective phase ϕ_(i)and at the data input a comparison signal, and provides at output arespective signal CMP_PH_FIN(i).

Specifically, in the embodiment considered each comparison signalindicates whether the respective signal CMP_PH(i) is low (with 0≤i≤n−1),i.e., the inverted version INV(CMP_PH(i)) is high, and the respectivesignal CMP_PH(i−1) is high. Specifically, the first comparison signal isgenerated as a function of the signals CMP_PH(0) and CMP_PH(n−1). Forexample, the comparison signals may be generated via logic AND gatesAND₀..AND_(n-1), each logic and gate AND_(i) receiving at input thesignal CMP_PH(i−1) (or CMP_PH(n−1) when i=0) and the inverted version ofthe signal CMP_PH(i).

Thus, essentially, the first two stages FFa and FFb generatesynchronization trigger signals CMP_PH(0) . . . CMP_PH(n), wherein

-   -   each flip flop FFA_(i) samples, in response to a rising edge in        the asynchronous event signal AE, a respective clock phase        ϕ_(i); and    -   each flip flop FFb_(i) sets it output to high when, in response        to a falling edge in the respective clock phase ϕ_(i), the        signal at the output of the respective flip flop FFA_(i) of the        first stage is high.

Conversely, the third stage FFc determines the phase value PV.Specifically, as shown in FIG. 18, when an asynchronous event AE isgenerated, there will be only one single set of adjacent clock phases,wherein the previous ϕ_(i-1) is high and the following ϕ_(i) is low. Forexample, considering the instant t₁, the clock phase ϕ₁ is high and theclock phase ϕ₂ is low. Thus, the third stage verifies for each index ithe couple/set of signals CMP_PH(i−1) and CMP_PH(i), wherein the signalCMP_PH(i−1) is high and the signal CMP_PH(i) is low, wherein the value irepresents the phase value PV. Specifically, in the embodimentconsidered, the third phase generates the signals CMP_PH_FIN(0) . . .CMP_PH_FIN(n−1), wherein only one of the signals CMP_PH_FIN(0) . . .CMP_PH_FIN(n−1) is set to high. Thus, essentially, the signalsCMP_PH_FIN(0) . . . CMP_PH_FIN(n−1) represent a one-hot-encoding of theindex i/phase value PV.

Generally, the first two stages may both introduce metastability,insofar as the asynchronous event signal AE and the clock phases ϕ₀ . .. ϕ_(n-1) are not synchronized. However, the comparison mechanism of thethird stage is also useful to solve such potential metastability issues.In fact, by construction, only on one single channel CMP_PH(i) may havea metastability. Assuming a structure perfectly balanced, thismetastable value is expected to be solved within half phase clock periodthus arriving with the same logic value at the input of a pair of ANDgates where it is effectively used thus allowing the last flip flop FFclevel to store the correct value.

In the embodiment considered, the registers FFb and FFc work as a doubleedge synchronizer; in general, each of the synchronization chainsFFb_(i) and FFc_(i) may be implemented also with more flip-flopsconnected in cascade.

In various embodiments, the registers FFa, FFb and FFc are configured tobe reset in response to a reset signal RST, such as the previousmentioned signal s_rst_dump. Generally, such a reset signalRST/s_rst_dump may be generated by any suitable circuit 312, andessentially activates the detection of the next asynchronous event AE.For example, in the embodiment considered, the registers are reset inresponse to a falling edge of the signal RST.

As mentioned before, in various embodiments, the counter circuit 104 (orsimilarly 104 a and 104 b) may use an adaptive clock signal CLK_TMR asdescribed in the foregoing, wherein this clock signal CLK_TMRcorresponds (during a given time period, such as the switch-on durationT_(ON) and/or the switch-off duration T_(OFF)) to one of the clockphases ϕ₀ . . . ϕ_(n-1).

Thus, as shown in FIG. 20, the circuit 30 may comprises a circuit 314configured to calculate a phase difference value PV′ as a function ofthe clock phase ϕ₀ . . . ϕ_(n-1) used by the counter 104, e.g., asindicated by the selection signal SEL1, and the phase value PV detectedby stage FFc.

Of course, without prejudice to the principle of the disclosure, thedetails of construction and the embodiments may vary widely with respectto what has been described and illustrated herein purely by way ofexample, without thereby departing from the scope of the presentdisclosure, as defined by the ensuing claims.

The various embodiments described above can be combined to providefurther embodiments. These and other changes can be made to theembodiments in light of the above-detailed description. In general, inthe following claims, the terms used should not be construed to limitthe claims to the specific embodiments disclosed in the specificationand the claims, but should be construed to include all possibleembodiments along with the full scope of equivalents to which suchclaims are entitled. Accordingly, the claims are not limited by thedisclosure.

The invention claimed is:
 1. A time measurement circuit configured togenerate a phase value, the time measurement circuit comprising: amultiphase clock generator configured to generate a sequence of a givennumber n of phase shifted clock phases having a same clock period andbeing phase shifted by a time corresponding to a fraction 1/n of saidclock period, wherein one of said phase shifted clock phases representsa reference clock signal; a node configured to receive an asynchronousevent signal; a phase sampling circuit configured to generate said phasevalue, said phase value being indicative of a number of said fractions1/n of said clock period elapsed between an edge of said reference clocksignal and an instant when said asynchronous event signal is set.
 2. Thetime measurement circuit according to claim 1, wherein said phasesampling circuit includes: a first sub-circuit including for each ofsaid phase shifted clock phases a respective first flip-flop configuredto, in response to said asynchronous event signal, sample the respectivephase shifted clock phase, thereby determining a respective firstcontrol signal indicating whether the respective clock phase was set tohigh or low at the instant when said asynchronous event signal was set;a second sub-circuit including for each of said phase shifted clockphases a respective second flip-flop configured to, in response to therespective phase shifted clock phase, sample the respective firstcontrol signal, thereby determining a respective second control signalcorresponding to a synchronized version of the respective first controlsignal; a third sub-circuit configured to: associate with each of saidphase shifted clock phases a further clock phase, said further clockphase corresponding to the phase shifted clock phase of said sequence ofphase shifted clock phases preceding the respective clock phase withsaid time; determine for each of said phase shifted clock phases arespective third control signal indicating whether: the second controlsignal associated with the respective phase shifted clock phaseindicates that the respective phase shifted clock phase was set to lowat the instant when said asynchronous event signal was set, and thesecond control signal associated with the respective further clock phaseindicates that the respective further clock phase was set to high at theinstant when said asynchronous event signal was set; and a fourthsub-circuit including for each of said phase shifted clock phases arespective third flip-flop configured to, in response to the respectivephase shifted clock phase, sample the respective third control signal,thereby determining a respective fourth control signal corresponding toa synchronized version of the respective third control signal.
 3. Thetime measurement circuit according to claim 2, wherein: each of saidfirst flip-flops is configured to sample the respective phase shiftedclock phase in response to a rising edge of said asynchronous eventsignal; and each of said second flip-flops is configured to sample therespective first control signal in response to a falling edge of therespective phase shifted clock phase.
 4. The time measurement circuitaccording to claim 2, including for each of said phase shifted clockphases a respective logic OR gate configured to receive at input therespective first control signal provided by said respective firstflip-flop and the respective second control signal provided by saidrespective second flip-flop, thereby determining a respective fifthcontrol signal, and wherein each of said second flip-flops is configuredto sample the respective fifth control signal, whereby each of saidsecond flip-flops samples the respective first control signal only whenthe respective first control signal is set to high.
 5. The timemeasurement circuit according to claim 2, wherein said third sub-circuitincludes for each of said phase shifted clock phases a respective logicAND gate, each logic AND gate configured to receive at input an invertedversion of the second control signal associated with the respectivephase shifted clock phase, and the second control signal associated withthe respective further clock phase, thereby generating the respectivethird control signal.
 6. The time measurement circuit according to claim2, wherein: each of said third flip-flops is configured to sample therespective third control signal in response to a rising edge of therespective phase shifted clock phase.
 7. The time measurement circuitaccording to claim 2, wherein said first, second and third flip-flopsare configured to be reset via a reset signal.
 8. The time measurementcircuit according to claim 2, wherein a further flip-flop is connectedin cascade with each of said second or said third flip-flops.
 9. Thetime measurement circuit according to claim 2, wherein said fourthcontrol signals represents a one-hot encoding of said phase value. 10.The time measurement circuit according to claim 2, wherein saidreference clock signal is selected among said phase shifted clock phasesas a function of a selection signal, and wherein said phase value isdetermined as a function of said fourth control signals and saidselection signal.
 11. The time measurement circuit according to claim 1,comprising: a counter circuit configured to increase a count value inresponse to said reference clock signal; and a counter sampling circuitconfigured to generate a sampled count value by sampling said countvalue.
 12. The time measurement circuit according to claim 11, whereinsaid counter sampling circuit comprises: a first sampling circuitconfigured to, in response to a rising edge of said reference clocksignal, sample said asynchronous event signal, thereby generating afirst synchronized asynchronous event signal; a second sampling circuitconfigured to, in response to a falling edge of said reference clocksignal, sample said asynchronous event signal, thereby generating asecond synchronized asynchronous event signal; and a sampling circuitconfigured to, in response to a rising edge of said reference clocksignal, store either the count value of said counter circuit or thecount value of said counter circuit decreased by one as a function ofsaid first and said second synchronized asynchronous event signal,thereby generating said sampled count value.
 13. A system, comprising: atime measurement circuit, including: a multiphase clock generatorconfigured to generate a sequence of a given number n of phase shiftedclock phases having a same clock period and being phase shifted by atime corresponding to a fraction 1/n of said clock period, wherein oneof said phase shifted clock phases represents a reference clock signal;a node configured to receive an asynchronous event signal; a phasesampling circuit configured to generate a phase value, said phase valuebeing indicative of a number of said fractions 1/n of said clock periodelapsed between an edge of said reference clock signal and an instantwhen said asynchronous event signal is set; a counter circuit configuredto increase a count value in response to said reference clock signal;and a counter sampling circuit configured to generate a sampled countvalue by sampling said count value; and a Pulse-Width Modulated (PWM)signal generator circuit configured to generate a Pulse Width Modulatedsignal as a function of the count value of said counter circuit, whereinsaid sampled count value and said phase value are indicative of a numberof clock cycles and the fractions 1/n of said reference clock signalelapsed between an edge of said Pulse-Width Modulated signal and theinstant when said asynchronous event signal was set.
 14. The systemaccording to claim 13, wherein the phase sampling circuit includes: afirst sub-circuit including for each of said phase shifted clock phasesa respective first flip-flop configured to, in response to saidasynchronous event signal, sample the respective phase shifted clockphase, thereby determining a respective first control signal indicatingwhether the respective clock phase was set to high or low at the instantwhen said asynchronous event signal was set; a second sub-circuitincluding for each of said phase shifted clock phases a respectivesecond flip-flop configured to, in response to the respective phaseshifted clock phase, sample the respective first control signal, therebydetermining a respective second control signal corresponding to asynchronized version of the respective first control signal; a thirdsub-circuit configured to: associate with each of said phase shiftedclock phases a further clock phase, said further clock phasecorresponding to the phase shifted clock phase of said sequence of phaseshifted clock phases preceding the respective clock phase with saidtime; determine for each of said phase shifted clock phases a respectivethird control signal indicating whether: the second control signalassociated with the respective phase shifted clock phase indicates thatthe respective phase shifted clock phase was set to low at the instantwhen said asynchronous event signal was set, and the second controlsignal associated with the respective further clock phase indicates thatthe respective further clock phase was set to high at the instant whensaid asynchronous event signal was set; and a fourth sub-circuitincluding for each of said phase shifted clock phases a respective thirdflip-flop configured to, in response to the respective phase shiftedclock phase, sample the respective third control signal, therebydetermining a respective fourth control signal corresponding to asynchronized version of the respective third control signal.
 15. Thesystem according to claim 14, wherein the time measurement circuitincludes: a respective logic OR gate for each of said phase shiftedclock phases, the OR gate configured to receive at input the respectivefirst control signal provided by said respective first flip-flop and therespective second control signal provided by said respective secondflip-flop, thereby determining a respective fifth control signal, andwherein each of said second flip-flops is configured to sample therespective fifth control signal, whereby each of said second flip-flopssamples the respective first control signal only when the respectivefirst control signal is set to high.
 16. The system according to claim14, wherein the third sub-circuit of the time measurement circuitincludes: a respective logic AND gate for each of said phase shiftedclock phases, each logic AND gate configured to receive at input aninverted version of the second control signal associated with therespective phase shifted clock phase, and the second control signalassociated with the respective further clock phase, thereby generatingthe respective third control signal.
 17. An integrated circuit,comprising: a time measurement circuit, including: a multiphase clockgenerator configured to generate a sequence of a given number n of phaseshifted clock phases having a same clock period and being phase shiftedby a time corresponding to a fraction 1/n of said clock period, whereinone of said phase shifted clock phases represents a reference clocksignal; a node configured to receive an asynchronous event signal; aphase sampling circuit configured to generate said a phase value, saidphase value being indicative of a number of said fractions 1/n of saidclock period elapsed between an edge of said reference clock signal andan instant when said asynchronous event signal is set.
 18. Theintegrated circuit according to claim 17, wherein the phase samplingcircuit includes: a first sub-circuit including for each of said phaseshifted clock phases a respective first flip-flop configured to, inresponse to said asynchronous event signal, sample the respective phaseshifted clock phase, thereby determining a respective first controlsignal indicating whether the respective clock phase was set to high orlow at the instant when said asynchronous event signal was set; a secondsub-circuit including for each of said phase shifted clock phases arespective second flip-flop configured to, in response to the respectivephase shifted clock phase, sample the respective first control signal,thereby determining a respective second control signal corresponding toa synchronized version of the respective first control signal; a thirdsub-circuit configured to: associate with each of said phase shiftedclock phases a further clock phase, said further clock phasecorresponding to the phase shifted clock phase of said sequence of phaseshifted clock phases preceding the respective clock phase with saidtime; determine for each of said phase shifted clock phases a respectivethird control signal indicating whether: the second control signalassociated with the respective phase shifted clock phase indicates thatthe respective phase shifted clock phase was set to low at the instantwhen said asynchronous event signal was set, and the second controlsignal associated with the respective further clock phase indicates thatthe respective further clock phase was set to high at the instant whensaid asynchronous event signal was set; and a fourth sub-circuitincluding for each of said phase shifted clock phases a respective thirdflip-flop configured to, in response to the respective phase shiftedclock phase, sample the respective third control signal, therebydetermining a respective fourth control signal corresponding to asynchronized version of the respective third control signal.
 19. Theintegrated circuit of claim 17, wherein the time measurement circuitincludes: a counter circuit configured to increase a count value inresponse to said reference clock signal; and a counter sampling circuitconfigured to generate a sampled count value by sampling said countvalue.
 20. The integrated circuit of claim 19, further comprising: aPulse-Width Modulated (PWM) signal generator circuit configured togenerate a Pulse-Width Modulated signal as a function of the count valueof said counter circuit, wherein said sampled count value and said phasevalue are indicative of a number of clock cycles and the fractions 1/nof said reference clock signal elapsed between an edge of saidPulse-Width Modulated signal and the instant when said asynchronousevent signal was set.